<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="icon" href="../static/images/elm.ico" type="image/x-icon"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>饿了么数据分析登录</title>
    <!-- 引入 Bootstrap -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body style = " background-image:url('../static/images/bg2.jpg');height: auto;">
      <div class="container-full-about" style="height: 500px;">
        <div class="span12" style="padding-top: 50px;">
            <h1 style="text-align: center; color: rgb(255, 255, 255); ">
                饿了么数据分析系统
            </h1>
        </div>
        <div class="container" style="margin-top: 50px;">
            <div class="span12">
                <div>
                    <div class="col-xs-4 col-md-4" >                      
                    </div>
                    
                    <div class="col-xs-4 col-md-4" >
                        <h4 style="color: white; text-align: center;" >登录</h4> 
                        <h4 style="color: white;float: left;" >手机号：</h4>   
                        <input id="telephone" type="text" class="form-control" name="telephone" placeholder="请输入手机号" maxlength="11" oninput="value=value.replace(/[^\d]/g,'')">
                        <br><br><br>
                        <div class="col-xs-12 col-md-12 " style="text-align: center;">
                            <button id="login_btn" type="submit" class="btn btn-primary " style="align-items: center;" name="submit" value="login">登录</button>
                            <button id="success_login_btn" type="button" class="btn btn-primary">已完成登录</button>
                        </div>
                    </div>
                 </div>
            </div>
        </div>  
    </div>
    <div class="container" style="text-align: center;color:black; font-size: 15px;">
        <p>Copyright:  FJNU</p>
    </div>
    <!-- jQuery (Bootstrap 的 JavaScript 插件需要引入 jQuery) -->
    <script src="https://code.jquery.com/jquery.js"></script>
    <script>
        $(document).on('click','#login_btn',function(){
            let telephone = $("#telephone").val();
            $.ajax({
                type: 'GET',
                url: 'getCode',
                data: {
                    telephone: telephone
                },
                success:function(){
                   console.log("success");
                }
            });
        });
        $(document).on('click','#success_login_btn',function () {
            $.ajax({
                type: 'GET',
                url: 'checkCookie',
                success:function (res) {
                    if(res.status === "success"){
                        if(res.redirect_url != null){
                            window.location = res.redirect_url;
                        }else{
                            window.location = "/";
                        }
                    }else{
                        alert("尚未检测到您登录，请重试，登录后请先点击本按钮再关闭弹出登录页")
                    }
                }
            });
        });
    </script>
</body>
</html>